package com.groupbuying.payproducer.service.impl;

import com.groupbuying.payproducer.constants.CommonConstants;
import com.groupbuying.payproducer.constants.PayOrderRelSearchConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.groupbuying.payproducer.dao.PayOrderRelDao;
import com.groupbuying.payproducer.domain.PayOrderRelDO;
import com.groupbuying.payproducer.service.PayOrderRelService;



@Service
public class PayOrderRelServiceImpl implements PayOrderRelService {
	@Autowired
	private PayOrderRelDao payOrderRelDao;

	@Override
	public PayOrderRelDO get(String id){
		return payOrderRelDao.get(id);
	}

	@Override
	public List<PayOrderRelDO> list(Map<String, Object> map){
		return payOrderRelDao.list(map);
	}

	@Override
	public int count(Map<String, Object> map){
		return payOrderRelDao.count(map);
	}

	@Override
	public int save(PayOrderRelDO payOrderRel){
		return payOrderRelDao.save(payOrderRel);
	}

	@Override
	public int update(PayOrderRelDO payOrderRel){
		return payOrderRelDao.update(payOrderRel);
	}

	@Override
	public int remove(String id){
		return payOrderRelDao.remove(id);
	}

	@Override
	public int batchRemove(String[] ids){
		return payOrderRelDao.batchRemove(ids);
	}

	@Override
	public PayOrderRelDO getRelBuyPayId(String payId){
		Map serarchMap = new HashMap();
		serarchMap.put(PayOrderRelSearchConstants.SEARCH_ID,payId);
		serarchMap.put(PayOrderRelSearchConstants.SEARCH_ISDELETE, CommonConstants.COMMON_FLAG_UNDEL);
		List<PayOrderRelDO> list = this.list(serarchMap);
		if(list != null && list.size() != 0){
			return list.get(0);
		}
		return null;
	}
}
